package PrototypePattern.example.Pen;

import PrototypePattern.example.framework.Product;

public class BoxPen implements Product {
    private char chr;

    public BoxPen(char c) {
        this.chr = c;
    }

    @Override
    public void use(String s) {
        int length = s.length();
        for (int i = 0; i < length + 4; i++) {
            System.out.print(chr);
        }
        System.out.println("");
        System.out.println(chr + " " + s + " " + chr);
        for (int i = 0; i < length + 4; i++) {
            System.out.print(chr);
        }
        System.out.println("");
    }

    @Override
    public Product createClone() {
        Product p = null;
        try {
            p = (Product) clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return p;
    }
}
